<template>
	<view class="container">
		<block v-if="listData.length == 0">
			<view class="all_empty">
				<u-empty mode="data" text="会员列表为空"></u-empty>
			</view>
		</block>
		<block v-else>
			<u-cell-group>
				<block v-for="(item,index) in listData" :key="index">
					<u-cell title="个人设置" isLink :url="'/pages/work/detail/detail?id='+item.id">
						<view slot="title" class="title">
							<!-- <u--image :src="item.avatar" width="60" height="60"></u--image> -->
							<view class="title_right">
								<view class="name">昵称：{{item.name}}</view>
								<view class="time">添加时间：{{$u.timeFormat(new Date(item.create_time).getTime(), 'yyyy年mm月dd日')}}</view>
							</view>
						</view>
					</u-cell>
				</block>
				
			</u-cell-group>
			<u-loadmore v-if="listData.length > queryForm.limit" :status="status" :loading-text="loadingText" :loadmore-text="loadmoreText" :nomore-text="nomoreText" />
			
		</block>
	</view>
</template>

<script>
export default {
	data() {
		return {
			searchForm: {
				page: 1,
				limit: 10,
				is_user: 'N'
			},
			
		};
	},
	onLoad({ is_user }) {
		if (is_user == 'Y') {
			uni.setNavigationBarTitle({
				title: '会员'
			});
		} else {
			uni.setNavigationBarTitle({
				title: '非会员'
			});
		}
		this.searchForm.is_user = is_user;
		this.getInfo();
	},
	methods: {
		getInfo(is_add = false) {
			let _this = this;
			_this
				.$http('crop/getUserMemberList', {
					..._this.searchForm
				})
				.then((res) => {
					if (res.code) {
						if (is_add) {
							_this.listData = _this.listData.concat(res.data.data);
						} else {
							_this.listData = res.data.data;
						}
						if (_this.listData.length >= res.data.total) {
							this.status = 'nomore';
						} else {
							this.status = 'loadmore';
						}
					}
				});
		}
	}
};
</script>

<style lang="scss" scoped>
	.title {
		display: flex;
		flex-direction: row;
		align-items: center;
		&_right{
			margin-left: 20rpx;
			.time {
				color: $common-color-info;
				font-size: 28rpx;
			}
		}
	}
</style>
